Repository navigation
Phase 5: metrics per output, model report plots, feature selection on the horizon error - #75
Merged
Merged
Conversation
… on the horizon error - Metrics.by_output: MSE, RMSE, MAE, R2 and bias per output and split (legacy flat keys kept); several outputs are no longer flattened together. HorizonMetrics adds the standard deviation of the error per step. - One plot report for all models: true vs. predicted with small transparent points, bold binned median and IQR band per split, sorted predictions, horizon error with bias +- sigma band, training history (incl. multi step training), metrics table per output; large point clouds are thinned out for display. - Plots are not opened by default: the pipelines save them as html next to the model, show_plot=True opens them; Model.plot returns the figure. - FeatureSelection (experimental): backward elimination on the step weighted horizon error, repeated on several block splits, bias at the MPC horizon, sign check of the sensitivity to the controls, tolerance for fewer inputs; no input() prompts and no mutation of the preprocessing. recursive_feature_elimination_pipeline wraps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 5 of the 1.0.0 refactoring. Stacked on #74: until #74 is merged, the diff also contains Phase 4. After that merge GitHub retargets this PR to
refactoring_v1.0.0and starts the CI.Metrics per output
td.metrics.by_output[output][split]holds MSE, RMSE, MAE, R² and bias (mean of prediction − truth). Previously several outputs were evaluated flattened together, mixing their units.'RMSE Val', …) stay. With several outputs they hold the mean over the outputs.HorizonMetricsadditionally holds the standard deviation of the error per step.Plots
All models now use one report (
physXAI.plotting.model_report). Per output it contains:Large point clouds (e.g. RNN trajectories) are thinned out to 20 000 points for display. The statistics use all values.
Plots no longer open by default.
pipeline(..., plot=True)saves the report as<model>.htmlnext to the model, or into the Logger's run folder.show_plot=Trueopens it, andModel.plot(td)returns the figure. Plotly is loaded from the CDN, so a report is about 70 kB, or 1.4 MB for the RNN.Feature selection (experimental)
physXAI.feature_selection.selection.FeatureSelectionreplaces the old implementation:eval_horizon(optionallyfirst_step_weight, plusbias_weight· |bias| atmpc_horizon). Alternativelycriterion='single_step'.n_repeats: every candidate is evaluated on several block splits (seeds), giving mean and spread. This shows whether differences between candidates exceed the noise.controls={'oveHeaPumY_u': 1}: checks the sign of the sensitivity of the prediction to a control on the validation data. Candidates with the wrong sign are marked implausible and not selected. Controls and the recursive feature are never removed.tolerance: selects the smallest input set within (1 + tolerance) × the best criterion.input()prompts and the preprocessing is not changed.result.table()(DataFrame),get_config()(JSON) andplot().recursive_feature_elimination_pipelineremains as a wrapper and saves JSON and HTML into the run folder.Example
TAir_FeatureSelection.py(LinReg, 12 inputs, horizon 12 h, 3 block splits): the spread of the criterion across the splits (σ ≈ 0.05 K at about 0.19 K) is larger than most differences between candidates. This confirms the point that a single split and the single step error are not a reliable basis for the choice.Tests
🤖 Generated with Claude Code